<?php

namespace App\Console\Commands;

use App\Customer;
use Illuminate\Console\Command;
use function foo\func;

class Customers extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'customer:name1';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
       $customer= \App\Customers::query();
       $oute=$this->output->createProgressBar($customer->count());
        \App\Customers::chunkById(100,function($items)use ($oute){
            foreach ($items as $item){
                $oute->advance();
              $customer=  Customer::find($item->customer_id);
              if ($customer){
                  $customer->owner_user_id=$item->owner_user_id;
                  $customer->save();
              }
            }
        });
        $oute->finish();
    }
}
